package com.ailk.bigdata.etl.realstream.server.protocal.aipr.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ailk.bigdata.etl.realstream.server.model.RealStreamUnit;
import com.ailk.bigdata.etl.realstream.server.monitor.EventCounter;
import com.ailk.bigdata.etl.realstream.server.protocal.aipr.service.UserCtlCmdService;
import com.ailk.bigdata.etl.realstream.server.protocal.aipr.service.impl.StreamDataAcceptListenThread;
import com.ailk.bigdata.etl.realstream.server.service.DataAcceptService;

/**
 * 
 * @description TODO
 * @author [xuwei3]
 * @version [版本号,2014-11-8]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
public class AiprDataAcceptServiceImpl implements DataAcceptService
{
	private static Logger logger = LoggerFactory.getLogger(AiprDataAcceptServiceImpl.class);

	private static StreamDataAcceptListenThread dataListenTh;

	/**
	 * 
	 * @see com.ailk.bigdata.etl.realstream.server.service.DataAcceptService#initRealStreamAcceptService(com.ailk.bigdata.etl.realstream.server.monitor.EventCounter)
	 */
	public void initRealStreamAcceptService(EventCounter eventCount, RealStreamUnit... perStream)
	{
		// ai a口协议启动用户命令监听服务
		UserCtlCmdService cmdService = new UserCtlCmdServiceImpl();
		cmdService.initUserCtlCmdListen();

		if (dataListenTh == null)
		{
			dataListenTh = new StreamDataAcceptListenThread(eventCount);
		}
		if (!dataListenTh.isAlive())
		{
			logger.info("启动数据接收线程.........");
			dataListenTh.start();
		}
	}

}
